﻿@model CustomerBackInStockSubscriptionsModel
@using Nop.Web.Extensions;
@using Nop.Web.Models.Customer;
@{    
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";

    Html.AddTitleParts(T("PageTitle.BackInStockSubscriptions").Text);
}
@section left
{
    @Html.Partial("MyAccountNavigation", Model.NavigationModel, new ViewDataDictionary())
}
<div class="page account-page back-in-stock-subscription-list-page">
    <div class="page-title">
        <h1>@T("Account.MyAccount") - @T("Account.BackInStockSubscriptions")</h1>
    </div>
    <div class="page-body">
        @if (Model.Subscriptions.Count > 0)
        {
            <div class="description">
                @T("Account.BackInStockSubscriptions.Description")
            </div>
            <script type="text/javascript">
                $(document).ready(function () {

                    $('#selectall').click(function () {
                        $('.subscription-list .rowcheckbox').attr('checked', $(this).is(':checked')).change();
                    });

                    $('.subscription-list .rowcheckbox').on('change', function (e) {
                        var numChkBoxes = $('.subscription-list .rowcheckbox').length;
                        var numChkBoxesChecked = $('.subscription-list .rowcheckbox:checked').length;
                        $('#selectall').attr('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
                    });
                });
            </script>        
            using (Html.BeginRouteForm("CustomerBackInStockSubscriptions", FormMethod.Post))
            {
            <div class="subscription-list">
                <table class="data-table">
                    <colgroup>
                        <col width="1" />
                        <col />
                    </colgroup>
                    <thead>
                        <tr>
                            <th class="a-center select-boxes">
                                <input type="checkbox" id="selectall" />
                            </th>
                            <th class="a-center product">
                                @T("Account.BackInStockSubscriptions.ProductColumn")
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @for (int i = 0; i < Model.Subscriptions.Count; i++)
                        {
                            var item = Model.Subscriptions[i];
                            <tr @(i % 2 == 0 ? Html.Raw(" class=\"odd\"") : Html.Raw(" class=\"even\""))>
                                <td class="a-center select-boxes">
                                    <input type="checkbox" name="biss@(item.Id)" class="rowcheckbox" />
                                </td>
                                <td class="a-left product">
                                    @Html.RouteLink(item.ProductName, "Product", new { SeName = item.SeName })
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
                <div class="pager">
                    @Html.Pager(Model.PagerModel)
                </div>
                <div class="buttons">
                    <input type="submit" value="@T("Account.BackInStockSubscriptions.DeleteSelected")" class="button-2 delete-selected-biss-button" />
                </div>
            </div>
            }
        }
        else
        {
            <div class="no-data">
                @T("Account.BackInStockSubscriptions.NoSubscriptions")
            </div>
        }
    </div>
</div>
